<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Search  extends CI_Controller {

	public function index()
	{           
                      
	}
        
        public function search_tag($tag_id)
        { 
            $this->load->model('tag_model','',TRUE);  
            $this->load->model('media_model','',TRUE);   
            $data['results'] = $this->media_model->get_all_media_by_tag($tag_id);
            $data['tags'] = $this->tag_model->get_all_tags();
            $data['query_tag'] = $this->tag_model->get_tag_name($tag_id);
            $this->load->view('search', $data); 
        }     
        public function query()
        { 
            $this->load->model('tag_model','',TRUE);
            $this->load->model('media_model','',TRUE);    
            $data['results'] = $this->media_model->get_media_by_query($this->input->post('query_string'));                      
            $data['tags'] = $this->tag_model->get_all_tags();
            $data['query_string'] = $this->input->post('query_string');
            $this->load->view('search', $data); 
        }     
}